home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / cvs-berliner / part01 next >
Encoding:
Internet Message Format  |  1990-06-07  |  58.3 KB

  1. Subject:  v22i015:  Brian Berliner's concurrent RCS system, Part01/07
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 2e4f71b5 6560370a adbc5e59 9bdddc8d
  5.  
  6. Submitted-by: Brian Berliner <berliner@prisma.com>
  7. Posting-number: Volume 22, Issue 15
  8. Archive-name: cvs-berliner/part01
  9.  
  10. [ Brian has the patience of a saint.  If you don't have PIC you'll have
  11.   to rip some lines out of the paper in the doc directory.  --r$ ]
  12.  
  13. CVS is a freely available collection of programs that provide for software
  14. release and revision control functions in a UNIX environment.  It is
  15. designed to work on top of the RCS distribution, V4 (uses the V4 branch
  16. support).  CVS does understand how to parse older RCS formats, but cannot
  17. do any of the fancier features (like vendor branch support) without RCS
  18. branch support.
  19.  
  20. The conflict-resolution algorithms and much of the administrative file
  21. definitions of CVS were based on the original package written by Dick Grune
  22. at Vrije Universiteit in Amsterdam, and posted to comp.sources.unix in the
  23. volume 6 release sometime in 1986.  This original version was a collection
  24. of shell scripts. 
  25.  
  26. Brian Berliner from Prisma, Inc. converted the original CVS shell scripts
  27. into reasonably fast C and added many, many features to support software
  28. release control functions.  See the manual page in the "man" directory, and
  29. a copy of the USENIX article presented at the Winter 1990 USENIX
  30. Conference, Washington D.C., is included in the "doc" directory.
  31.  
  32.  
  33. #! /bin/sh
  34. # This is a shell archive.  Remove anything before this line, then unpack
  35. # it by saving it into a file and typing "sh file".  To overwrite existing
  36. # files, type "sh file -c".  You can also feed this as standard input via
  37. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  38. # will see the following message at the end:
  39. #        "End of archive 1 (of 7)."
  40. # Contents:  MANIFEST Makefile README doc doc/Makefile examples
  41. #   examples/Makefile examples/loginfo man man/Makefile
  42. #   man/checkin.man man/mkmodules.man src src/build_entry.c
  43. #   src/create_admin.c src/entries_file.c src/find_names.c src/join.c
  44. #   src/locate_rcs.c src/log.c src/name_repository.c
  45. #   src/no_difference.c src/options.c src/patchlevel.h src/rcstime.h
  46. #   src/register.c src/remove.c src/scratch_entry.c src/status.c
  47. #   src/version_ts.c
  48. # Wrapped by rsalz@litchi.bbn.com on Thu May  3 16:58:59 1990
  49. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  50. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  51.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  52. else
  53. echo shar: Extracting \"'MANIFEST'\" \(1770 characters\)
  54. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  55. X   File Name        Archive #    Description
  56. X-----------------------------------------------------------
  57. X COPYING                    4    
  58. X MANIFEST                   1    
  59. X Makefile                   1    
  60. X README                     1    
  61. X doc                        1    
  62. X doc/Makefile               1    
  63. X doc/cvs.ms                 6    
  64. X examples                   1    
  65. X examples/Makefile          1    
  66. X examples/loginfo           1    
  67. X examples/modules           5    
  68. X man                        1    
  69. X man/Makefile               1    
  70. X man/checkin.man            1    
  71. X man/cvs.man                7    
  72. X man/mkmodules.man          1    
  73. X src                        1    
  74. X src/Makefile               4    
  75. X src/add.c                  2    
  76. X src/build_entry.c          1    
  77. X src/checkin.c              2    
  78. X src/checkin.csh            3    
  79. X src/checkout.c             2    
  80. X src/collect_sets.c         3    
  81. X src/commit.c               5    
  82. X src/create_admin.c         1    
  83. X src/cvs.h                  2    
  84. X src/diff.c                 2    
  85. X src/entries_file.c         1    
  86. X src/find_names.c           1    
  87. X src/join.c                 1    
  88. X src/locate_rcs.c           1    
  89. X src/log.c                  1    
  90. X src/main.c                 3    
  91. X src/maketime.c             2    
  92. X src/mkmodules.c            2    
  93. X src/modules.c              3    
  94. X src/name_repository.c      1    
  95. X src/no_difference.c        1    
  96. X src/options.c              1    
  97. X src/partime.c              5    
  98. X src/patch.c                4    
  99. X src/patchlevel.h           1    
  100. X src/rcstime.h              1    
  101. X src/register.c             1    
  102. X src/remove.c               1    
  103. X src/scratch_entry.c        1    
  104. X src/set_lock.c             2    
  105. X src/status.c               1    
  106. X src/subr.c                 3    
  107. X src/tag.c                  2    
  108. X src/update.c               4    
  109. X src/version_number.c       3    
  110. X src/version_ts.c           1    
  111. END_OF_FILE
  112. if test 1770 -ne `wc -c <'MANIFEST'`; then
  113.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  114. fi
  115. # end of 'MANIFEST'
  116. fi
  117. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  118.   echo shar: Will not clobber existing file \"'Makefile'\"
  119. else
  120. echo shar: Extracting \"'Makefile'\" \(1109 characters\)
  121. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  122. X#
  123. X#    $Id: Makefile,v 1.1 89/11/19 23:15:10 berliner Exp $
  124. X#
  125. X# Master Makefile for CVS
  126. X#
  127. X
  128. XDESTDIR=    /usr/local/bin
  129. XCFLAGS=        -O # -g
  130. XLDFLAGS=    # -Bstatic
  131. XSUBDIRS=    doc examples man src
  132. X
  133. XFILES=        README Makefile COPYING
  134. XSHAR=        shar
  135. X
  136. Xall:
  137. X    @for i in ${SUBDIRS}; do\
  138. X        (cd $$i; ${MAKE} ${MFLAGS} DESTDIR="${DESTDIR}"\
  139. X            CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}");\
  140. X    done
  141. X
  142. Xinstall:
  143. X    @for i in ${SUBDIRS}; do\
  144. X        (cd $$i; ${MAKE} ${MFLAGS} DESTDIR="${DESTDIR}"\
  145. X            CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" install);\
  146. X    done
  147. X
  148. Xclean:
  149. X    @for i in ${SUBDIRS}; do\
  150. X        echo $$i:;\
  151. X        (cd $$i; ${MAKE} ${MFLAGS} DESTDIR="${DESTDIR}"\
  152. X            CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" clean);\
  153. X    done
  154. X
  155. Xshar:
  156. X    @rm -f ${SHAR}.[0-9]*
  157. X    makekit -p -s45k -n${SHAR}. `make -s list`
  158. X
  159. Xlist:
  160. X    @for i in ${FILES}; do\
  161. X        echo $$i;\
  162. X    done
  163. X    @for i in ${SUBDIRS}; do\
  164. X        echo $$i;\
  165. X        (cd $$i; ${MAKE} ${MFLAGS} DESTDIR="${DESTDIR}"\
  166. X            CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" list) |\
  167. X        sed -e "s1^1$$i/1";\
  168. X    done
  169. X
  170. Xdepend:
  171. X    @for i in ${SUBDIRS}; do\
  172. X        (cd $$i; ${MAKE} ${MFLAGS} DESTDIR="${DESTDIR}"\
  173. X            CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" depend);\
  174. X    done
  175. END_OF_FILE
  176. if test 1109 -ne `wc -c <'Makefile'`; then
  177.     echo shar: \"'Makefile'\" unpacked with wrong size!
  178. fi
  179. # end of 'Makefile'
  180. fi
  181. if test -f 'README' -a "${1}" != "-c" ; then 
  182.   echo shar: Will not clobber existing file \"'README'\"
  183. else
  184. echo shar: Extracting \"'README'\" \(6170 characters\)
  185. sed "s/^X//" >'README' <<'END_OF_FILE'
  186. X$Id: README,v 1.3 89/11/19 23:15:11 berliner Exp $
  187. X
  188. X
  189. X               CVS Kit, Version 1.0
  190. X
  191. X            Copyright (c) 1989, Brian Berliner
  192. X
  193. X    This program is free software; you can redistribute it and/or modify
  194. X    it under the terms of the GNU General Public License as published by
  195. X    the Free Software Foundation; either version 1, or (at your option)
  196. X    any later version.
  197. X
  198. X    This program is distributed in the hope that it will be useful,
  199. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  200. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  201. X    GNU General Public License for more details.
  202. X
  203. X    You should have received a copy of the GNU General Public License
  204. X    along with this program; if not, write to the Free Software
  205. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  206. X
  207. X--------------------------------------------------------------------------
  208. X
  209. XThis is the first release of CVS -- Concurrent Version System.
  210. X
  211. XCVS is a freely available collection of programs that provide for software
  212. Xrelease and revision control functions in a UNIX environment.  It is
  213. Xdesigned to work on top of the RCS distribution, V4 (uses the V4 branch
  214. Xsupport).  CVS does understand how to parse older RCS formats, but cannot
  215. Xdo any of the fancier features (like vendor branch support) without RCS
  216. Xbranch support.
  217. X
  218. XThe conflict-resolution algorithms and much of the administrative file
  219. Xdefinitions of CVS were based on the original package written by Dick Grune
  220. Xat Vrije Universiteit in Amsterdam, and posted to comp.sources.unix in the
  221. Xvolume 6 release sometime in 1986.  This original version was a collection
  222. Xof shell scripts. 
  223. X
  224. XBrian Berliner from Prisma, Inc. converted the original CVS shell scripts
  225. Xinto reasonably fast C and added many, many features to support software
  226. Xrelease control functions.  See the manual page in the "man" directory, and
  227. Xa copy of the USENIX article presented at the Winter 1990 USENIX
  228. XConference, Washington D.C., is included in the "doc" directory.
  229. X
  230. XThis code has been tested extensively on Sun-4 and Sun-3 platforms, all
  231. Xrunning SunOS 4.X.  Your mileage may vary for other systems, and I would
  232. Xreally appreciate hearing back on what was necessary to get this beast
  233. Xworking on other platforms.
  234. X
  235. XInstallation:
  236. X
  237. X1)  Edit the top-level Makefile (in this directory) and set DESTDIR to the
  238. X    location of local binaries.  Also adjust CFLAGS and LDFLAGS
  239. X    appropriately as well.  May also need to edit the man/Makefile file to
  240. X    be sure that manual pages will be dropped in the correct place for your
  241. X    system.
  242. X
  243. X2)  Edit the src/cvs.h header file.  Appropriate things to look at may be
  244. X    the hard-coded locations of programs like DIFF, GREP, RM, and SORT.
  245. X    Also glance at the default values for the environment variables that
  246. X    CVS uses, in particular, the RCSBIN variable, which holds the path to
  247. X    where the RCS programs live on your system.
  248. X
  249. X3)  make depend
  250. X
  251. X    To get the Makefiles to use *your* include dependencies, not mine.
  252. X
  253. X4)  make
  254. X
  255. X    This will (hopefully) make the needed CVS binaries within the "src"
  256. X    directory.
  257. X
  258. X5)  make install
  259. X
  260. X    If all goes well above, install the binaries and manual pages.
  261. X    Depending on your instrallation's configuration, you may need to be
  262. X    root to do this.
  263. X
  264. X6)  man cvs
  265. X
  266. X    Take a look at the CVS manual page to see what it can do for you, and
  267. X    if it fits your environment (or can possibly be made to fit your
  268. X    environment).  If things look good, continue on...
  269. X
  270. X7)  Setup the master source repository.  Choose a directory with ample disk
  271. X    space available for source files.  This is where the RCS ",v" files
  272. X    will be stored.  Say you choose "/src/master" as the root of your
  273. X    source repository.  Make the CVSROOT.adm directory in the root of the
  274. X    source repository:  "mkdir /src/master/CVSROOT.adm".  Populate this
  275. X    directory with the files from the "examples" directory included with
  276. X    this release (loginfo and modules).  Edit these files
  277. X    (/src/master/CVSROOT.adm/{loginfo,modules}) to reflect your local
  278. X    source repository environment -- they may be quite small initially, but
  279. X    will grow as sources are added to your source repository.  Turn these
  280. X    files into RCS controlled files:
  281. X
  282. X        cd /src/master/CVSROOT.adm
  283. X        ci -m'Initial loginfo file' loginfo
  284. X        ci -m'Initial modules file' modules
  285. X
  286. X8)  mkmodules /src/master/CVSROOT.adm
  287. X
  288. X    This will build the ndbm(3) file for the modules database.  mkmodules
  289. X    should have been installed above by the "make install" done in step 5.
  290. X    If mkmodules cannot be found, check your PATH or try "rehash".
  291. X
  292. X9)  Have all users of the CVS system set the CVSROOT environment variable
  293. X    appropriately to reflect the placement of your source repository.  If
  294. X    the above example is used, the following commands can be placed in
  295. X    user's ~/.login or ~/.profile file:
  296. X
  297. X        setenv CVSROOT /src/master
  298. X    for csh users, and
  299. X        CVSROOT=/src/master; export CVSROOT
  300. X    for sh users.
  301. X
  302. X10) It might be a good idea to jump right in and put the CVS distribution
  303. X    directly under CVS control.  From within the top-level directory of the
  304. X    CVS distribution (the one that contains this README file) do the
  305. X    following commands:
  306. X
  307. X        mkdir $CVSROOT/cvs
  308. X        checkin -m 'CVS 1.0 distribution' cvs CVS CVS1_0
  309. X
  310. X11) Having done step 10, one should be able to checkout a copy of the CVS
  311. X    distribution and hack away at the sources with the following command:
  312. X
  313. X        cvs checkout cvs
  314. X
  315. X    This will make the directory "cvs" in your current directory and
  316. X    populate it with the appropriate CVS files and directories.
  317. X
  318. X12) Remember to edit the modules file manually when sources are checked in
  319. X    with "checkin" or "cvs add".  A copy of the modules file for editing
  320. X    can usually be retrieved with the "cvs checkout modules" command, and
  321. X    definitely with the "cvs checkout CVSROOT.adm" command.
  322. X
  323. X13) PLEASE report any problems to me, berliner@prisma.com (Brian Berliner)
  324. X    and I will try to collect patches and enhancements into future CVS
  325. X    distributions.  "patch" format files are best, using context diffs,
  326. X    if you will.
  327. X
  328. X14) GOOD LUCK!
  329. X
  330. X                    Brian Berliner
  331. X                    berliner@prisma.com
  332. END_OF_FILE
  333. if test 6170 -ne `wc -c <'README'`; then
  334.     echo shar: \"'README'\" unpacked with wrong size!
  335. fi
  336. # end of 'README'
  337. fi
  338. if test ! -d 'doc' ; then
  339.     echo shar: Creating directory \"'doc'\"
  340.     mkdir 'doc'
  341. fi
  342. if test -f 'doc/Makefile' -a "${1}" != "-c" ; then 
  343.   echo shar: Will not clobber existing file \"'doc/Makefile'\"
  344. else
  345. echo shar: Extracting \"'doc/Makefile'\" \(401 characters\)
  346. sed "s/^X//" >'doc/Makefile' <<'END_OF_FILE'
  347. X#
  348. X#    $Id: Makefile,v 1.1 89/11/19 23:16:41 berliner Exp $
  349. X#
  350. X# Makefile for CVS document for the Winter 1990 USENIX Conference,
  351. X# Washington D.C.
  352. X#
  353. X
  354. XTROFF=        nitroff
  355. XTROFFOPTS=    -ms
  356. XPIC=        pic
  357. XTBL=        tbl
  358. X
  359. XCVSDOC=        cvs.ms
  360. XFILES=        Makefile ${CVSDOC}
  361. X
  362. Xall:
  363. X
  364. Xprint:
  365. X    ${PIC} ${CVSDOC} | ${TBL} | ${TROFF} ${TROFFOPTS}
  366. X
  367. Xinstall:
  368. X
  369. Xclean:
  370. X    rm -f *.o core
  371. X
  372. Xlist:
  373. X    @for i in ${FILES}; do\
  374. X        echo $$i;\
  375. X    done
  376. X
  377. Xdepend:
  378. END_OF_FILE
  379. if test 401 -ne `wc -c <'doc/Makefile'`; then
  380.     echo shar: \"'doc/Makefile'\" unpacked with wrong size!
  381. fi
  382. # end of 'doc/Makefile'
  383. fi
  384. if test ! -d 'examples' ; then
  385.     echo shar: Creating directory \"'examples'\"
  386.     mkdir 'examples'
  387. fi
  388. if test -f 'examples/Makefile' -a "${1}" != "-c" ; then 
  389.   echo shar: Will not clobber existing file \"'examples/Makefile'\"
  390. else
  391. echo shar: Extracting \"'examples/Makefile'\" \(279 characters\)
  392. sed "s/^X//" >'examples/Makefile' <<'END_OF_FILE'
  393. X#
  394. X#    $Id: Makefile,v 1.1 89/11/19 23:17:17 berliner Exp $
  395. X#
  396. X# Makefile for CVS sample files that reside in the $CVSROOT/CVSROOT.adm
  397. X# directory
  398. X#
  399. X
  400. XFILES=        Makefile loginfo modules
  401. X
  402. Xall:
  403. X
  404. Xinstall:
  405. X
  406. Xclean:
  407. X    rm -f *.o core
  408. X
  409. Xlist:
  410. X    @for i in ${FILES}; do\
  411. X        echo $$i;\
  412. X    done
  413. X
  414. Xdepend:
  415. END_OF_FILE
  416. if test 279 -ne `wc -c <'examples/Makefile'`; then
  417.     echo shar: \"'examples/Makefile'\" unpacked with wrong size!
  418. fi
  419. # end of 'examples/Makefile'
  420. fi
  421. if test -f 'examples/loginfo' -a "${1}" != "-c" ; then 
  422.   echo shar: Will not clobber existing file \"'examples/loginfo'\"
  423. else
  424. echo shar: Extracting \"'examples/loginfo'\" \(1027 characters\)
  425. sed "s/^X//" >'examples/loginfo' <<'END_OF_FILE'
  426. X#
  427. X# $Id: loginfo,v 1.1 89/08/24 23:59:59 berliner Exp $
  428. X#
  429. X# The "loginfo" file is used to control where "cvs commit" log information
  430. X# is sent.  The first entry on a line is a regular expression which is tested
  431. X# against the directory that the change is being made to, relative to the
  432. X# $CVSROOT.  If a match is found, then the remainder of the line is a filter
  433. X# program that should expect log information on its standard input.
  434. X#
  435. X# The filter program may use one and only one % modifier (ala printf).  If
  436. X# %s is specified in the filter program, a brief title is included (enclosed
  437. X# in single quotes) showing the modified file names.
  438. X#
  439. X# If the repository name does not match any of the regular expressions in this
  440. X# file, the "DEFAULT" line is used, if it is specified.
  441. X#
  442. XDEFAULT            /usr/local/bin/nfpipe -t %s utils.updates
  443. X^diag            /usr/local/bin/nfpipe -t %s diag.updates
  444. X^local            /usr/local/bin/nfpipe -t %s local.updates
  445. X^perf            /usr/local/bin/nfpipe -t %s perf.updates
  446. X^sys            /usr/local/bin/nfpipe -t %s kernel.updates
  447. END_OF_FILE
  448. if test 1027 -ne `wc -c <'examples/loginfo'`; then
  449.     echo shar: \"'examples/loginfo'\" unpacked with wrong size!
  450. fi
  451. # end of 'examples/loginfo'
  452. fi
  453. if test ! -d 'man' ; then
  454.     echo shar: Creating directory \"'man'\"
  455.     mkdir 'man'
  456. fi
  457. if test -f 'man/Makefile' -a "${1}" != "-c" ; then 
  458.   echo shar: Will not clobber existing file \"'man/Makefile'\"
  459. else
  460. echo shar: Extracting \"'man/Makefile'\" \(440 characters\)
  461. sed "s/^X//" >'man/Makefile' <<'END_OF_FILE'
  462. X#
  463. X#    $Id: Makefile,v 1.1 89/11/19 23:17:41 berliner Exp $
  464. X#
  465. X# Makefile for CVS Manual Pages
  466. X#
  467. XMANSEC=        l
  468. XMANEXT=        .man
  469. XMANDIR=        /usr/man/man${MANSEC}
  470. XMANSRCS=    cvs${MANEXT} mkmodules${MANEXT} checkin${MANEXT}
  471. X
  472. XFILES=        Makefile ${MANSRCS}
  473. X
  474. Xall:
  475. X
  476. Xinstall:
  477. X    for i in ${MANSRCS}; do\
  478. X        install -m 644 $$i\
  479. X            ${MANDIR}/`basename $$i ${MANEXT}`.${MANSEC};\
  480. X    done
  481. X
  482. Xclean:
  483. X    rm -f *.o core
  484. X
  485. Xlist:
  486. X    @for i in ${FILES}; do\
  487. X        echo $$i;\
  488. X    done
  489. X
  490. Xdepend:
  491. END_OF_FILE
  492. if test 440 -ne `wc -c <'man/Makefile'`; then
  493.     echo shar: \"'man/Makefile'\" unpacked with wrong size!
  494. fi
  495. # end of 'man/Makefile'
  496. fi
  497. if test -f 'man/checkin.man' -a "${1}" != "-c" ; then 
  498.   echo shar: Will not clobber existing file \"'man/checkin.man'\"
  499. else
  500. echo shar: Extracting \"'man/checkin.man'\" \(3081 characters\)
  501. sed "s/^X//" >'man/checkin.man' <<'END_OF_FILE'
  502. X.\"
  503. X.\"    $Id: checkin.man,v 1.2 89/11/19 23:17:43 berliner Exp $
  504. X.\"
  505. X.TH CHECKIN L "16 November 1989"
  506. X.SH "NAME"
  507. Xcheckin \- Check a vendor source distribution into CVS
  508. X.SH "SYNOPSIS"
  509. X.B checkin 
  510. X[
  511. X.I \-v
  512. X] [
  513. X.I \-m message
  514. X] [
  515. X.I \-f message_file
  516. X] 
  517. X.I repository vendor_tag vendor_release_tag
  518. X.SH "DESCRIPTION"
  519. X.LP
  520. X.B checkin
  521. Xtraverses the tree rooted at the current directory checking all files 
  522. Xinto the vendor branch of the repository directory located at 
  523. X.IR CVSROOT/repository .
  524. XIf 
  525. X.I SCCS 
  526. Xor 
  527. X.I RCS 
  528. Xdirectories exist under the current directory, 
  529. X.B checkin 
  530. Xchecks out all files before committing them to the repository.  Any 
  531. X.I RCS
  532. Xor
  533. X.I SCCS 
  534. Xdirectories are then ignored when the files are checked in.
  535. X.LP
  536. X.B checkin
  537. Xlogs all updates to locally modified files, new files, and new 
  538. Xdirectories to the standard output. If the 
  539. X.I \-v
  540. Xoption is specified it will log all updates instead of just the
  541. Xinteresting ones.
  542. X.LP
  543. XWhen invoked with the 
  544. X.I \-m
  545. Xflag, 
  546. X.B checkin 
  547. Xtakes the next argument to be the log message to use when 
  548. Xchecking in the files.  The 
  549. X.I \-f
  550. Xflag specifies the name of a file to use as the log message.  If 
  551. Xneither 
  552. X.I \-m
  553. Xor 
  554. X.I \-f
  555. Xis specified, 
  556. X.B checkin 
  557. Xinvokes your favorite editor for you to create a log message.
  558. X.LP
  559. XEach file is checked into the vendor branch specified by the 
  560. X.I vendor_tag 
  561. Xon the command line.  If the specified branch does not exist, 
  562. X.B checkin
  563. Xcreates the branch 1.1.1 and labels it with the specified tag.  As
  564. Xeach file is checked in, it is labeled with the 
  565. X.I vendor_release_tag 
  566. Xand logged with the specified log message.
  567. X.LP 
  568. X.B checkin 
  569. Xalso understands about the way 
  570. X.B cvs
  571. Xremoves files from a repository by moving them to an 
  572. X.I attic
  573. Xsub-directory.
  574. XIf a new version of a removed file is encountered, 
  575. X.B checkin 
  576. Xwill update the copy of the file in the attic and will log 
  577. Xthe update to the standard output.  The file can be brought back 
  578. Xinto existence with the 
  579. X.B cvs
  580. X.I add
  581. Xcommand (see the 
  582. X.B cvs
  583. Xman page for more details).
  584. X.LP
  585. XIf 
  586. X.B checkin
  587. Xencounters a file with an extension that 
  588. X.BI rcs (l)
  589. Xdoesn't recognize that contains the 
  590. X.BI rcs (l)
  591. X.I $log$ 
  592. Xheader, it will prompt the terminal for a comment leader for that
  593. Xtype of file.
  594. X.SH "OPTIONS"
  595. X.TP
  596. X.I \-v
  597. Xcauses 
  598. X.B checkin
  599. Xto print a message as all files are updated instead of only printing 
  600. Xthem for 
  601. X.I interesting
  602. Xones.
  603. X.TP
  604. X.I \-m message
  605. Xspecifies the string to use as the log message for each update.
  606. X.TP
  607. X.I \-f file
  608. Xspecifies a file containing the log message to use for each update.
  609. X.SH "ENVIRONMENT VARIABLES"
  610. X.TP
  611. X.SM CVSROOT
  612. Xspecifies the location of the root of the source repository.
  613. XThis variable must be present for 
  614. X.B checkin 
  615. Xto continue.
  616. X.TP
  617. X.SM EDITOR
  618. Xspecifies your favorite editor (defaults to 
  619. X.BR vi ).
  620. X.SH "SEE ALSO"
  621. X.BR ci (l),
  622. X.BR cvs (l),
  623. X.BR rcs (l).
  624. X.SH "BUGS"
  625. X.LP
  626. XShould know how to parse the 
  627. X.I CVSROOT/CVSROOT.adm/loginfo 
  628. Xfile to log all updates according to the same scheme as 
  629. X.B cvs 
  630. Xitself.
  631. X.LP
  632. XIts a real CPU pig, but it works okay and isn't used nearly 
  633. Xas much as other portions of 
  634. X.BR cvs .
  635. X
  636. END_OF_FILE
  637. if test 3081 -ne `wc -c <'man/checkin.man'`; then
  638.     echo shar: \"'man/checkin.man'\" unpacked with wrong size!
  639. fi
  640. # end of 'man/checkin.man'
  641. fi
  642. if test -f 'man/mkmodules.man' -a "${1}" != "-c" ; then 
  643.   echo shar: Will not clobber existing file \"'man/mkmodules.man'\"
  644. else
  645. echo shar: Extracting \"'man/mkmodules.man'\" \(1113 characters\)
  646. sed "s/^X//" >'man/mkmodules.man' <<'END_OF_FILE'
  647. X.\"
  648. X.\"    $Id: mkmodules.man,v 1.1 89/10/18 11:16:41 berliner Exp $
  649. X.\"
  650. X.TH MKMODULES L "9 October 1989"
  651. X.SH "NAME"
  652. Xmkmodules \- Rebuild modules database for CVS
  653. X.SH "SYNOPSIS"
  654. X.B mkmodules
  655. X.I directory
  656. X.SH "DESCRIPTION"
  657. X.B mkmodules
  658. Xrebuilds the modules database that
  659. X.BR cvs (l)
  660. Xuses.
  661. XThe
  662. X.I directory
  663. Xspecified is expected to contain the
  664. X.BR modules,v " and " loginfo,v
  665. Xfiles.
  666. X.B mkmodules
  667. Xcarefully checks out the current head revisions of each of these files and
  668. Xreuilds the
  669. X.BR ndbm (3)
  670. Xformat modules database.
  671. XA warning is generated if the modules file contains a duplicate key.
  672. X.SH "FILES"
  673. X.TP
  674. Xmodules,v
  675. XThe modules
  676. X.SM RCS
  677. Xfile.
  678. X.TP
  679. Xmodules
  680. XThe checked out modules file.
  681. X.TP
  682. Xloginfo,v
  683. XThe loginfo
  684. X.SM RCS
  685. Xfile.
  686. X.TP
  687. Xloginfo
  688. XThe checked out loginfo file.
  689. X.TP
  690. Xmodules.dir, modules.pag
  691. XThe
  692. X.BR ndbm (l)
  693. Xformat modules database.
  694. X.SH "ENVIRONMENT VARIABLES"
  695. X.TP
  696. X.SM RCSBIN
  697. XSpecifies the full pathname where to find
  698. X.SM RCS
  699. Xprograms, such as
  700. X.BR co (l)
  701. Xand
  702. X.BR ci (l).
  703. XIf not set, the default is
  704. X.BR /usr/local/bin .
  705. X.SH "SEE ALSO"
  706. X.BR checkin (l),
  707. X.BR co (l),
  708. X.BR cvs (l),
  709. X.BR ndbm (3),
  710. X.BR rcs (l),
  711. X.SH "BUGS"
  712. END_OF_FILE
  713. if test 1113 -ne `wc -c <'man/mkmodules.man'`; then
  714.     echo shar: \"'man/mkmodules.man'\" unpacked with wrong size!
  715. fi
  716. # end of 'man/mkmodules.man'
  717. fi
  718. if test ! -d 'src' ; then
  719.     echo shar: Creating directory \"'src'\"
  720.     mkdir 'src'
  721. fi
  722. if test -f 'src/build_entry.c' -a "${1}" != "-c" ; then 
  723.   echo shar: Will not clobber existing file \"'src/build_entry.c'\"
  724. else
  725. echo shar: Extracting \"'src/build_entry.c'\" \(2581 characters\)
  726. sed "s/^X//" >'src/build_entry.c' <<'END_OF_FILE'
  727. X#ifndef lint
  728. Xstatic char rcsid[] = "$Id: build_entry.c,v 1.9 89/11/19 23:19:45 berliner Exp $";
  729. X#endif !lint
  730. X
  731. X/*
  732. X *    Copyright (c) 1989, Brian Berliner
  733. X *
  734. X *    You may distribute under the terms of the GNU General Public License
  735. X *    as specified in the README file that comes with the CVS 1.0 kit.
  736. X *
  737. X * Build Entry
  738. X *
  739. X *    Builds an entry for a new file and sets up "CVS.adm/file",[pt] by
  740. X *    interrogating the user.
  741. X *
  742. X *    Returns non-zero on error.
  743. X */
  744. X
  745. X#include <sys/param.h>
  746. X#include "cvs.h"
  747. X
  748. XBuild_Entry(message)
  749. X    char *message;
  750. X{
  751. X    char fname[MAXPATHLEN];
  752. X    char line[MAXLINELEN];
  753. X    FILE *fp, *fptty;
  754. X
  755. X    /*
  756. X     * There may be an old file with the same name in the Attic!
  757. X     * This is, perhaps, an awkward place to check for this, but
  758. X     * other places are equally awkward.
  759. X     */
  760. X    (void) sprintf(fname, "%s/%s/%s%s", Repository, CVSATTIC, User, RCSEXT);
  761. X    if (isreadable(fname)) {
  762. X    warn(0, "there is an old file %s already in %s/%s", User,
  763. X         Repository, CVSATTIC);
  764. X    return (1);
  765. X    }
  766. X    /*
  767. X     * The options for the "add" command are store in the file CVS.adm/User,p
  768. X     */
  769. X    (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  770. X    fp = open_file(fname, "w+");
  771. X    if (fprintf(fp, "%s\n", Options) == EOF)
  772. X    error(1, "cannot write %s", fname);
  773. X    (void) fclose(fp);
  774. X    /*
  775. X     * And the requested log is read directly from the user and stored
  776. X     * in the file User,t.  If the "message" argument is set, then the
  777. X     * user specified the -m option to add, and it is not necessary to
  778. X     * query him from the terminal.
  779. X     */
  780. X    (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_LOG);
  781. X    fp = open_file(fname, "w+");
  782. X    if (message[0] == '\0') {
  783. X    printf("RCS file: %s\n", Rcs);
  784. X    printf("enter description, terminated with ^D or '.':\n");
  785. X    printf("NOTE: This is NOT the log message!\n");
  786. X    fptty = open_file("/dev/tty", "r");
  787. X    for (;;) {
  788. X        printf(">> ");
  789. X        (void) fflush(stdout);
  790. X        if (fgets(line, sizeof(line), fptty) == NULL ||
  791. X        (line[0] == '.' && line[1] == '\n'))
  792. X        break;
  793. X        if (fputs(line, fp) == EOF)
  794. X        error(1, "cannot write to %s", fname);
  795. X    }
  796. X    printf("done\n");
  797. X    (void) fclose(fptty);
  798. X    } else {
  799. X    if (fputs(message, fp) == EOF)
  800. X        error(1, "cannot write to %s", fname);
  801. X    }
  802. X    (void) fclose(fp);
  803. X    /*
  804. X     * Create the entry now, since this allows the user to interrupt
  805. X     * us above without needing to clean anything up (well, we could
  806. X     * clean up the ,p and ,t files, but who cares).
  807. X     */
  808. X    (void) sprintf(line, "Initial %s", User);
  809. X    Register(User, "0", line);
  810. X    return (0);
  811. X}
  812. END_OF_FILE
  813. if test 2581 -ne `wc -c <'src/build_entry.c'`; then
  814.     echo shar: \"'src/build_entry.c'\" unpacked with wrong size!
  815. fi
  816. # end of 'src/build_entry.c'
  817. fi
  818. if test -f 'src/create_admin.c' -a "${1}" != "-c" ; then 
  819.   echo shar: Will not clobber existing file \"'src/create_admin.c'\"
  820. else
  821. echo shar: Extracting \"'src/create_admin.c'\" \(1321 characters\)
  822. sed "s/^X//" >'src/create_admin.c' <<'END_OF_FILE'
  823. X#ifndef lint
  824. Xstatic char rcsid[] = "$Id: create_admin.c,v 1.7 89/11/19 23:19:55 berliner Exp $";
  825. X#endif !lint
  826. X
  827. X/*
  828. X *    Copyright (c) 1989, Brian Berliner
  829. X *
  830. X *    You may distribute under the terms of the GNU General Public License
  831. X *    as specified in the README file that comes with the CVS 1.0 kit.
  832. X *
  833. X * Create Administration.
  834. X *
  835. X *    Creates a CVS administration directory based on the argument
  836. X *    repository; the "Entries" file is prefilled from the "initrecord"
  837. X *    argument.
  838. X */
  839. X
  840. X#include <sys/param.h>
  841. X#include "cvs.h"
  842. X
  843. XCreate_Admin(repository, initrecord)
  844. X    register char *repository;
  845. X    register char *initrecord;
  846. X{
  847. X    register FILE *fout;
  848. X    char *cp;
  849. X
  850. X    if (!isdir(repository))
  851. X    error(0, "there is no repository %s", repository);
  852. X    if (!isfile(initrecord))
  853. X    error(0, "there is no file %s", initrecord);
  854. X    if (isfile(CVSADM))
  855. X    error(0, "there is a version here already");
  856. X    make_directory(CVSADM);
  857. X    fout = open_file(CVSADM_REP, "w+");
  858. X    cp = repository;
  859. X    if (CVSroot != NULL) {
  860. X    char path[MAXPATHLEN];
  861. X
  862. X    (void) sprintf(path, "%s/", CVSroot);
  863. X    if (strncmp(repository, path, strlen(path)) == 0)
  864. X        cp = repository + strlen(path);
  865. X    }
  866. X    if (fprintf(fout, "%s\n", cp) == EOF)
  867. X    error(1, "write to %s failed", CVSADM_REP);
  868. X    (void) fclose(fout);
  869. X    copy_file(initrecord, CVSADM_ENT);
  870. X}
  871. END_OF_FILE
  872. if test 1321 -ne `wc -c <'src/create_admin.c'`; then
  873.     echo shar: \"'src/create_admin.c'\" unpacked with wrong size!
  874. fi
  875. # end of 'src/create_admin.c'
  876. fi
  877. if test -f 'src/entries_file.c' -a "${1}" != "-c" ; then 
  878.   echo shar: Will not clobber existing file \"'src/entries_file.c'\"
  879. else
  880. echo shar: Extracting \"'src/entries_file.c'\" \(1342 characters\)
  881. sed "s/^X//" >'src/entries_file.c' <<'END_OF_FILE'
  882. X#ifndef lint
  883. Xstatic char rcsid[] = "$Id: entries_file.c,v 1.6 89/11/19 23:20:00 berliner Exp $";
  884. X#endif !lint
  885. X
  886. X/*
  887. X *    Copyright (c) 1989, Brian Berliner
  888. X *
  889. X *    You may distribute under the terms of the GNU General Public License
  890. X *    as specified in the README file that comes with the CVS 1.0 kit.
  891. X *
  892. X * Entries file to Files file
  893. X *
  894. X * Creates the file Files containing the names that comprise
  895. X * the project, from the Entries file.
  896. X */
  897. X
  898. X#include "cvs.h"
  899. X
  900. XEntries2Files()
  901. X{
  902. X    register FILE *fpin, *fpout;
  903. X    register int num = 0;
  904. X    register char *cp;
  905. X    char line[MAXLINELEN];
  906. X    char *fnames[MAXFILEPERDIR];
  907. X
  908. X    fpin = open_file(CVSADM_ENT, "r");
  909. X    fpout = open_file(CVSADM_FILE, "w+");
  910. X    while (fgets(line, sizeof(line), fpin) != NULL) {
  911. X    if ((cp = rindex(line, '|')) == NULL)
  912. X        continue;
  913. X    *cp = '\0';
  914. X    if ((cp = rindex(line, ' ')) == NULL)
  915. X        continue;
  916. X    cp++;
  917. X    fnames[num] = xmalloc(strlen(cp) + 1);
  918. X    (void) strcpy(fnames[num++], cp);
  919. X    if (num >= MAXFILEPERDIR)
  920. X        error(0, "more than %d files is too many", MAXFILEPERDIR);
  921. X    }
  922. X    if (num) {
  923. X    qsort((char *)&fnames[0], num, sizeof(fnames[0]), ppstrcmp_files);
  924. X    while (num--) {
  925. X        if (fprintf(fpout, "%s\n", fnames[num]) == EOF)
  926. X        error(1, "cannot write %s", CVSADM_FILE);
  927. X        free(fnames[num]);
  928. X    }
  929. X    }
  930. X    (void) fclose(fpin);
  931. X    (void) fclose(fpout);
  932. X}
  933. END_OF_FILE
  934. if test 1342 -ne `wc -c <'src/entries_file.c'`; then
  935.     echo shar: \"'src/entries_file.c'\" unpacked with wrong size!
  936. fi
  937. # end of 'src/entries_file.c'
  938. fi
  939. if test -f 'src/find_names.c' -a "${1}" != "-c" ; then 
  940.   echo shar: Will not clobber existing file \"'src/find_names.c'\"
  941. else
  942. echo shar: Extracting \"'src/find_names.c'\" \(3312 characters\)
  943. sed "s/^X//" >'src/find_names.c' <<'END_OF_FILE'
  944. X#ifndef lint
  945. Xstatic char rcsid[] = "$Id: find_names.c,v 1.11 89/11/19 23:20:02 berliner Exp $";
  946. X#endif !lint
  947. X
  948. X/*
  949. X *    Copyright (c) 1989, Brian Berliner
  950. X *
  951. X *    You may distribute under the terms of the GNU General Public License
  952. X *    as specified in the README file that comes with the CVS 1.0 kit.
  953. X *
  954. X * Find Names
  955. X *
  956. X *    Writes all the pertinent file names, both from the administration
  957. X *    and from the repository to the argc/argv arguments.
  958. X *
  959. X *    The names should be freed by callin free_names() when they are no
  960. X *    longer needed.
  961. X *
  962. X *    Note that Find_Names() honors the administration Entries.Static file
  963. X *    to indicate that the Repository should not be searched for new files.
  964. X */
  965. X
  966. X#include <sys/param.h>
  967. X#include <sys/types.h>
  968. X#include <dirent.h>
  969. X#include "cvs.h"
  970. X
  971. XFind_Names(pargc, argv, which)
  972. X    int *pargc;
  973. X    char *argv[];
  974. X    enum ftype which;
  975. X{
  976. X    char dir[MAXPATHLEN], line[MAXLINELEN];
  977. X    FILE *fpin;
  978. X    char *cp;
  979. X
  980. X    *pargc = 0;
  981. X    argv[0] = NULL;            /* Assume none */
  982. X    if (which == MOD) {
  983. X    fpin = open_file(CVSADM_MOD, "r");
  984. X    /*
  985. X     * Parse the Mod file, and calling addname() for each line.
  986. X     */
  987. X    while (fgets(line, sizeof(line), fpin) != NULL) {
  988. X        if ((cp = rindex(line, '\n')) != NULL)
  989. X        *cp = '\0';
  990. X        *cp = '\0';
  991. X        addname(pargc, argv, line);
  992. X    }
  993. X    (void) fclose(fpin);
  994. X    } else {
  995. X    fpin = open_file(CVSADM_ENT, "r");
  996. X    /*
  997. X     * Only scan for ,v files if Entries.Static does not exist
  998. X     */
  999. X    if (!isfile(CVSADM_ENTSTAT)) {
  1000. X        if (find_rcs(Repository, pargc, argv) != 0)
  1001. X        error(1, "cannot open directory %s", Repository);
  1002. X        if (which == ALLPLUSATTIC) {
  1003. X        (void) sprintf(dir, "%s/%s", Repository, CVSATTIC);
  1004. X        (void) find_rcs(dir, pargc, argv);
  1005. X        }
  1006. X    }
  1007. X    /*
  1008. X     * Parse the Entries file, and calling addname() for each one.
  1009. X     */
  1010. X    while (fgets(line, sizeof(line), fpin) != NULL) {
  1011. X        if ((cp = rindex(line, '|')) == NULL)
  1012. X        continue;
  1013. X        *cp = '\0';
  1014. X        if ((cp = rindex(line, ' ')) == NULL)
  1015. X        continue;
  1016. X        cp++;
  1017. X        addname(pargc, argv, cp);
  1018. X    }
  1019. X    (void) fclose(fpin);
  1020. X    }
  1021. X    /*
  1022. X     * And finally, sort the names so that they look reasonable
  1023. X     * as they are processed (there *is* order in the world)
  1024. X     */
  1025. X    qsort((char *)&argv[0], *pargc, sizeof(argv[0]), ppstrcmp);
  1026. X}
  1027. X
  1028. X/*
  1029. X * Finds all the ,v files in the argument directory, and adds them to the
  1030. X * argv list.  Returns 0 for success and non-zero if the argument
  1031. X * directory cannot be opened.
  1032. X */
  1033. Xstatic
  1034. Xfind_rcs(dir, pargc, argv)
  1035. X    char *dir;
  1036. X    int *pargc;
  1037. X    char *argv[];
  1038. X{
  1039. X    char *cp, line[50];
  1040. X    struct dirent *dp;
  1041. X    DIR *dirp;
  1042. X
  1043. X    if ((dirp = opendir(dir)) == NULL)
  1044. X    return (1);
  1045. X    (void) sprintf(line, ".*%s$", RCSEXT);
  1046. X    if ((cp = re_comp(line)) != NULL)
  1047. X    error(0, "%s", cp);
  1048. X    while ((dp = readdir(dirp)) != NULL) {
  1049. X    if (re_exec(dp->d_name)) {
  1050. X        /* strip the ,v */
  1051. X        *rindex(dp->d_name, ',') = '\0';
  1052. X        addname(pargc, argv, dp->d_name);
  1053. X    }
  1054. X    }
  1055. X    (void) closedir(dirp);
  1056. X    return (0);
  1057. X}
  1058. X
  1059. X/*
  1060. X * addname() adds a name to the argv array, only if it is not in
  1061. X * the array already
  1062. X */
  1063. Xstatic
  1064. Xaddname(pargc, argv, name)
  1065. X    int *pargc;
  1066. X    char *argv[];
  1067. X    char *name;
  1068. X{
  1069. X    register int i;
  1070. X
  1071. X    for (i = 0; i < *pargc; i++) {
  1072. X    if (strcmp(argv[i], name) == 0)
  1073. X        return;
  1074. X    }
  1075. X    (*pargc)++;
  1076. X    argv[i] = xmalloc(strlen(name) + 1);
  1077. X    (void) strcpy(argv[i], name);
  1078. X}
  1079. END_OF_FILE
  1080. if test 3312 -ne `wc -c <'src/find_names.c'`; then
  1081.     echo shar: \"'src/find_names.c'\" unpacked with wrong size!
  1082. fi
  1083. # end of 'src/find_names.c'
  1084. fi
  1085. if test -f 'src/join.c' -a "${1}" != "-c" ; then 
  1086.   echo shar: Will not clobber existing file \"'src/join.c'\"
  1087. else
  1088. echo shar: Extracting \"'src/join.c'\" \(3305 characters\)
  1089. sed "s/^X//" >'src/join.c' <<'END_OF_FILE'
  1090. X#ifndef lint
  1091. Xstatic char rcsid[] = "$Id: join.c,v 1.4 89/11/19 23:40:36 berliner Exp $";
  1092. X#endif !lint
  1093. X
  1094. X/*
  1095. X *    Copyright (c) 1989, Brian Berliner
  1096. X *
  1097. X *    You may distribute under the terms of the GNU General Public License
  1098. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1099. X *
  1100. X * Join
  1101. X *
  1102. X *    Do an implicit checkout and merge between RCS revisions in the
  1103. X *    RCS file.  This is most always used after the "checkin" script
  1104. X *    has added new revisions to files that have been locally modified.
  1105. X *    A manual "join" command can be run on the files listed in the
  1106. X *    "checkin" output to produce an "rcsmerge" of the current revision
  1107. X *    and the specified vendor branch revision.
  1108. X *
  1109. X *    Need to be careful if the local user file has been checked out and
  1110. X *    is modified.  Don't want to mess with it in this case.
  1111. X */
  1112. X
  1113. X#include "cvs.h"
  1114. X
  1115. Xextern char update_dir[];
  1116. Xextern int force_tag_match;
  1117. X
  1118. Xjoin(argc, argv)
  1119. X    int argc;
  1120. X    char *argv[];
  1121. X{
  1122. X    register int i;
  1123. X    int c, err = 0;
  1124. X
  1125. X    if (argc == -1)
  1126. X    join_usage();
  1127. X    optind = 1;
  1128. X    while ((c = getopt(argc, argv, "fQqD:r:")) != -1) {
  1129. X    switch (c) {
  1130. X    case 'Q':
  1131. X        really_quiet = 1;
  1132. X        /* FALL THROUGH */
  1133. X    case 'q':
  1134. X        quiet = 1;
  1135. X        break;
  1136. X    case 'f':
  1137. X        force_tag_match = 1;
  1138. X        break;
  1139. X    case 'D':
  1140. X        if (Tag[0] != '\0' || Date[0] != '\0')
  1141. X        error(0, "no more than one revision/date can be specified");
  1142. X        Make_Date(optarg, Date);
  1143. X        break;
  1144. X    case 'r':
  1145. X        if (Tag[0] != '\0' || Date[0] != '\0')
  1146. X        error(0, "no more than one revision/date can be specified");
  1147. X        (void) strcpy(Tag, optarg);
  1148. X        break;
  1149. X    case '?':
  1150. X    default:
  1151. X        join_usage();
  1152. X        break;
  1153. X    }
  1154. X    }
  1155. X    argc -= optind;
  1156. X    argv += optind;
  1157. X    if (argc < 1)
  1158. X    join_usage();
  1159. X    if (Tag[0] == '\0' && Date[0] == '\0')
  1160. X    error(0, "must specify one revision/date!");
  1161. X    Name_Repository();
  1162. X    Reader_Lock();
  1163. X    (void) Collect_Sets(argc, argv);
  1164. X    if (Clist[0] || Glist[0] || Mlist[0] || Alist[0] || Rlist[0] || Wlist[0])
  1165. X    error(0, "conflicts exist; cannot join a modified file");
  1166. X    if (Dlist[0])
  1167. X    error(0, "cannot join directories -%s", Dlist);
  1168. X    for (i = 0; i < argc; i++)
  1169. X    err += join_file(argv[i]);
  1170. X    Lock_Cleanup(0);
  1171. X    exit(err);
  1172. X}
  1173. X
  1174. X/*
  1175. X * Called for each file that is to be "join"ed.  Need to find out if the
  1176. X * file is modified or not, and blow it off if it is.
  1177. X */
  1178. Xstatic
  1179. Xjoin_file(file)
  1180. X    char *file;
  1181. X{
  1182. X    char vers[50];
  1183. X
  1184. X    (void) strcpy(User, file);
  1185. X    (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  1186. X    Version_Number(Rcs, Tag, Date, vers);
  1187. X    if (vers[0] == '\0') {
  1188. X    if (!quiet)
  1189. X        warn(0, "cannot find revision %s for %s", Tag[0] ? Tag:Date, Rcs);
  1190. X    return (1);
  1191. X    }
  1192. X    (void) unlink(User);
  1193. X    Scratch_Entry(User);
  1194. X    (void) sprintf(prog, "%s/%s -j%s %s %s", Rcsbin, RCS_CO, vers, Rcs, User);
  1195. X    if (system(prog) != 0) {
  1196. X    if (!quiet)
  1197. X        warn(0, "co of revision %s for %s failed", VN_Rcs, Rcs);
  1198. X    return (1);
  1199. X    }
  1200. X    if (!really_quiet)
  1201. X    printf("J %s\n", User);
  1202. X    if (cvswrite == TRUE)
  1203. X    xchmod(User, 1);
  1204. X    Version_TS(Rcs, "", User);        /* For head */
  1205. X    (void) sprintf(TS_User, "joined %s", User);    /* To appear to be modified */
  1206. X    Register(User, VN_Rcs, TS_User);
  1207. X    return (0);
  1208. X}
  1209. X
  1210. Xstatic
  1211. Xjoin_usage()
  1212. X{
  1213. X    (void) fprintf(stderr, "%s %s [-Qqf] [-r tag|-D date] files...\n",
  1214. X           progname, command);
  1215. X    exit(1);
  1216. X}
  1217. END_OF_FILE
  1218. if test 3305 -ne `wc -c <'src/join.c'`; then
  1219.     echo shar: \"'src/join.c'\" unpacked with wrong size!
  1220. fi
  1221. # end of 'src/join.c'
  1222. fi
  1223. if test -f 'src/locate_rcs.c' -a "${1}" != "-c" ; then 
  1224.   echo shar: Will not clobber existing file \"'src/locate_rcs.c'\"
  1225. else
  1226. echo shar: Extracting \"'src/locate_rcs.c'\" \(845 characters\)
  1227. sed "s/^X//" >'src/locate_rcs.c' <<'END_OF_FILE'
  1228. X#ifndef lint
  1229. Xstatic char rcsid[] = "$Id: locate_rcs.c,v 1.5 89/11/19 23:20:05 berliner Exp $";
  1230. X#endif !lint
  1231. X
  1232. X/*
  1233. X *    Copyright (c) 1989, Brian Berliner
  1234. X *
  1235. X *    You may distribute under the terms of the GNU General Public License
  1236. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1237. X *
  1238. X * Locate RCS File
  1239. X *
  1240. X * Called when the RCS file sought may be in the Attic directory.
  1241. X * Sets the global Rcs variable to the correct file.
  1242. X */
  1243. X
  1244. X#include <sys/param.h>
  1245. X#include "cvs.h"
  1246. X
  1247. XLocate_RCS()
  1248. X{
  1249. X    char old[MAXPATHLEN];
  1250. X
  1251. X    (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  1252. X    (void) sprintf(old, "%s/%s/%s%s", Repository, CVSATTIC, User, RCSEXT);
  1253. X    if (!isreadable(Rcs)) {
  1254. X    if (isreadable(old)) {
  1255. X        (void) strcpy(Rcs, old);
  1256. X    } else {
  1257. X        /*
  1258. X         * it is treated as if it were in the repository
  1259. X         */
  1260. X    }
  1261. X    }
  1262. X}
  1263. END_OF_FILE
  1264. if test 845 -ne `wc -c <'src/locate_rcs.c'`; then
  1265.     echo shar: \"'src/locate_rcs.c'\" unpacked with wrong size!
  1266. fi
  1267. # end of 'src/locate_rcs.c'
  1268. fi
  1269. if test -f 'src/log.c' -a "${1}" != "-c" ; then 
  1270.   echo shar: Will not clobber existing file \"'src/log.c'\"
  1271. else
  1272. echo shar: Extracting \"'src/log.c'\" \(1360 characters\)
  1273. sed "s/^X//" >'src/log.c' <<'END_OF_FILE'
  1274. X#ifndef lint
  1275. Xstatic char rcsid[] = "$Id: log.c,v 1.9 89/11/19 23:40:37 berliner Exp $";
  1276. X#endif !lint
  1277. X
  1278. X/*
  1279. X *    Copyright (c) 1989, Brian Berliner
  1280. X *
  1281. X *    You may distribute under the terms of the GNU General Public License
  1282. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1283. X *
  1284. X * Print Log Information
  1285. X *
  1286. X *    Prints the RCS "log" (rlog) information for the specified
  1287. X *    files.  With no argument, prints the log information for
  1288. X *    all the files in the directory.
  1289. X */
  1290. X
  1291. X#include "cvs.h"
  1292. X
  1293. Xlog(argc, argv)
  1294. X    int argc;
  1295. X    char *argv[];
  1296. X{
  1297. X    register int i;
  1298. X    int numopt, err = 0;
  1299. X    char *cp;
  1300. X
  1301. X    if (argc == -1)
  1302. X    log_usage();
  1303. X    Name_Repository();
  1304. X    /*
  1305. X     * All 'log' command options are passed directly on to 'rlog'
  1306. X     */
  1307. X    numopt = Get_Options(--argc, ++argv);
  1308. X    argc -= numopt;
  1309. X    argv += numopt;
  1310. X    if (argc == 0) {
  1311. X    Find_Names(&fileargc, fileargv, ALL);
  1312. X    argc = fileargc;
  1313. X    argv = fileargv;
  1314. X    }
  1315. X    (void) sprintf(prog, "%s/%s %s", Rcsbin, RCS_RLOG, Options);
  1316. X    cp = prog + strlen(prog);
  1317. X    for (i = 0; i < argc; i++) {
  1318. X    (void) strcpy(User, argv[i]);
  1319. X    Locate_RCS();
  1320. X    (void) strcpy(cp, " ");
  1321. X    (void) strcpy(cp+1, Rcs);
  1322. X    cp += strlen(Rcs) + 1;
  1323. X    }
  1324. X    err = system(prog);
  1325. X    exit(err);
  1326. X}
  1327. X
  1328. Xstatic
  1329. Xlog_usage()
  1330. X{
  1331. X    (void) fprintf(stderr,
  1332. X           "%s %s [rlog-options] [files...]\n", progname, command);
  1333. X    exit(1);
  1334. X}
  1335. END_OF_FILE
  1336. if test 1360 -ne `wc -c <'src/log.c'`; then
  1337.     echo shar: \"'src/log.c'\" unpacked with wrong size!
  1338. fi
  1339. # end of 'src/log.c'
  1340. fi
  1341. if test -f 'src/name_repository.c' -a "${1}" != "-c" ; then 
  1342.   echo shar: Will not clobber existing file \"'src/name_repository.c'\"
  1343. else
  1344. echo shar: Extracting \"'src/name_repository.c'\" \(1740 characters\)
  1345. sed "s/^X//" >'src/name_repository.c' <<'END_OF_FILE'
  1346. X#ifndef lint
  1347. Xstatic char rcsid[] = "$Id: name_repository.c,v 1.9 89/11/19 23:20:13 berliner Exp $";
  1348. X#endif !lint
  1349. X
  1350. X/*
  1351. X *    Copyright (c) 1989, Brian Berliner
  1352. X *
  1353. X *    You may distribute under the terms of the GNU General Public License
  1354. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1355. X *
  1356. X * Name of Repository
  1357. X *
  1358. X *    Determine the name of the RCS repository and sets "Repository"
  1359. X *    accordingly.
  1360. X */
  1361. X
  1362. X#include <sys/param.h>
  1363. X#include "cvs.h"
  1364. X
  1365. XName_Repository()
  1366. X{
  1367. X    FILE *fpin;
  1368. X    char path[MAXPATHLEN];
  1369. X    char *cp;
  1370. X
  1371. X    if (!isdir(CVSADM))
  1372. X    error(0, "there is no version here; do '%s checkout' first", progname);
  1373. X    if (!isreadable(CVSADM_REP) || !isreadable(CVSADM_ENT))
  1374. X    error(0, "*PANIC* administration files missing");
  1375. X    /*
  1376. X     * The assumption here is the the repository is always contained
  1377. X     * in the first line of the "Repository" file.
  1378. X     */
  1379. X    fpin = open_file(CVSADM_REP, "r");
  1380. X    if (fgets(Repository, MAXPATHLEN, fpin) == NULL)
  1381. X    error(1, "cannot read %s", CVSADM_REP);
  1382. X    (void) fclose(fpin);
  1383. X    if ((cp = rindex(Repository, '\n')) != NULL)
  1384. X    *cp = '\0';            /* strip the newline */
  1385. X    /*
  1386. X     * If this is a relative repository pathname, turn it into
  1387. X     * an absolute one by tacking on the CVSROOT environment variable.
  1388. X     * If the CVSROOT environment variable is not set, die now.
  1389. X     */
  1390. X    if (Repository[0] != '/') {
  1391. X    if (CVSroot == NULL) {
  1392. X        (void) fprintf(stderr,
  1393. X               "%s: must set the CVSROOT environment variable\n",
  1394. X               progname);
  1395. X        error(0, "or specify the '-d' option to %s", progname);
  1396. X    }
  1397. X    (void) strcpy(path, Repository);
  1398. X    (void) sprintf(Repository, "%s/%s", CVSroot, path);
  1399. X    }
  1400. X    if (!isdir(Repository))
  1401. X    error(0, "there is no repository %s", Repository);
  1402. X}
  1403. END_OF_FILE
  1404. if test 1740 -ne `wc -c <'src/name_repository.c'`; then
  1405.     echo shar: \"'src/name_repository.c'\" unpacked with wrong size!
  1406. fi
  1407. # end of 'src/name_repository.c'
  1408. fi
  1409. if test -f 'src/no_difference.c' -a "${1}" != "-c" ; then 
  1410.   echo shar: Will not clobber existing file \"'src/no_difference.c'\"
  1411. else
  1412. echo shar: Extracting \"'src/no_difference.c'\" \(1789 characters\)
  1413. sed "s/^X//" >'src/no_difference.c' <<'END_OF_FILE'
  1414. X#ifndef lint
  1415. Xstatic char rcsid[] = "$Id: no_difference.c,v 1.7 89/11/19 23:20:16 berliner Exp $";
  1416. X#endif !lint
  1417. X
  1418. X/*
  1419. X *    Copyright (c) 1989, Brian Berliner
  1420. X *
  1421. X *    You may distribute under the terms of the GNU General Public License
  1422. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1423. X *
  1424. X * No Difference
  1425. X *
  1426. X * The user file looks modified judging from its time stamp; however
  1427. X * it needn't be.  No_difference() finds out whether it is or not.
  1428. X * If it is, it adds its name to the Mlist.
  1429. X * If it is not, it updates the administration.
  1430. X *
  1431. X * If we're deciding if a modified file that is to be merged is really
  1432. X * modified (doGlist is set), we add the name to the Glist if it really
  1433. X * is modified, otherwise it is added to the Olist to be simply extracted.
  1434. X *
  1435. X * Returns non-zero on error.
  1436. X */
  1437. X
  1438. X#include <sys/param.h>
  1439. X#include "cvs.h"
  1440. X
  1441. XNo_Difference(doGlist)
  1442. X    int doGlist;
  1443. X{
  1444. X    char tmp[MAXPATHLEN];
  1445. X
  1446. X    (void) sprintf(tmp, "%s/%s%s", CVSADM, CVSPREFIX, User);
  1447. X    (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO,
  1448. X           VN_User, Rcs, tmp);
  1449. X    if (system(prog) == 0) {
  1450. X    if (xcmp(User, tmp) == 0) {
  1451. X        if (cvswrite == FALSE)
  1452. X        xchmod(User, 0);
  1453. X        Version_TS(Rcs, Tag, User);
  1454. X        (void) strcpy(TS_Rcs, TS_User);
  1455. X        Register(User, VN_Rcs, TS_User);
  1456. X        if (doGlist) {
  1457. X        (void) strcat(Olist, " ");
  1458. X        (void) strcat(Olist, User);
  1459. X        }
  1460. X    } else {
  1461. X        if (!iswritable(User))
  1462. X        xchmod(User, 1);
  1463. X        Version_TS(Rcs, Tag, User);
  1464. X        if (doGlist) {
  1465. X        (void) strcat(Glist, " ");
  1466. X        (void) strcat(Glist, User);
  1467. X        } else {
  1468. X        (void) strcat(Mlist, " ");
  1469. X        (void) strcat(Mlist, User);
  1470. X        }
  1471. X    }
  1472. X    (void) unlink(tmp);
  1473. X    } else {
  1474. X    warn(0, "could not check out revision %s of %s", VN_User, User);
  1475. X    (void) unlink(tmp);
  1476. X    return (1);
  1477. X    }
  1478. X    return (0);
  1479. X}
  1480. END_OF_FILE
  1481. if test 1789 -ne `wc -c <'src/no_difference.c'`; then
  1482.     echo shar: \"'src/no_difference.c'\" unpacked with wrong size!
  1483. fi
  1484. # end of 'src/no_difference.c'
  1485. fi
  1486. if test -f 'src/options.c' -a "${1}" != "-c" ; then 
  1487.   echo shar: Will not clobber existing file \"'src/options.c'\"
  1488. else
  1489. echo shar: Extracting \"'src/options.c'\" \(830 characters\)
  1490. sed "s/^X//" >'src/options.c' <<'END_OF_FILE'
  1491. X#ifndef lint
  1492. Xstatic char rcsid[] = "$Id: options.c,v 1.5 89/11/19 23:20:18 berliner Exp $";
  1493. X#endif !lint
  1494. X
  1495. X/*
  1496. X *    Copyright (c) 1989, Brian Berliner
  1497. X *
  1498. X *    You may distribute under the terms of the GNU General Public License
  1499. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1500. X *
  1501. X * Get Options
  1502. X *
  1503. X * Collects options from argc/argv and stuffs them into the
  1504. X * global Options variable.
  1505. X *
  1506. X * Returns the number of options grabbed.
  1507. X */
  1508. X
  1509. X#include "cvs.h"
  1510. X
  1511. XGet_Options(argc, argv)
  1512. X    int argc;
  1513. X    char *argv[];
  1514. X{
  1515. X    register int i;
  1516. X    register int numopts = 0;
  1517. X
  1518. X    Options[0] = '\0';            /* Assume none */
  1519. X    for (i = 0; i < argc; i++) {
  1520. X    if (argv[i][0] == '-' || argv[i][0] == '\0') {
  1521. X        numopts++;
  1522. X        (void) strcat(Options, " ");
  1523. X        (void) strcat(Options, argv[i]);
  1524. X    }
  1525. X    }
  1526. X    return (numopts);
  1527. X}
  1528. END_OF_FILE
  1529. if test 830 -ne `wc -c <'src/options.c'`; then
  1530.     echo shar: \"'src/options.c'\" unpacked with wrong size!
  1531. fi
  1532. # end of 'src/options.c'
  1533. fi
  1534. if test -f 'src/patchlevel.h' -a "${1}" != "-c" ; then 
  1535.   echo shar: Will not clobber existing file \"'src/patchlevel.h'\"
  1536. else
  1537. echo shar: Extracting \"'src/patchlevel.h'\" \(85 characters\)
  1538. sed "s/^X//" >'src/patchlevel.h' <<'END_OF_FILE'
  1539. X/*    $Id: patchlevel.h,v 1.1 89/11/20 00:06:30 berliner Exp $    */
  1540. X
  1541. X#define    PATCHLEVEL    0
  1542. END_OF_FILE
  1543. if test 85 -ne `wc -c <'src/patchlevel.h'`; then
  1544.     echo shar: \"'src/patchlevel.h'\" unpacked with wrong size!
  1545. fi
  1546. # end of 'src/patchlevel.h'
  1547. fi
  1548. if test -f 'src/rcstime.h' -a "${1}" != "-c" ; then 
  1549.   echo shar: Will not clobber existing file \"'src/rcstime.h'\"
  1550. else
  1551. echo shar: Extracting \"'src/rcstime.h'\" \(1351 characters\)
  1552. sed "s/^X//" >'src/rcstime.h' <<'END_OF_FILE'
  1553. X#define TIMEID "$Id: rcstime.h,v 1.1 89/05/09 11:51:03 berliner Exp $"
  1554. X
  1555. X/* Structure for use by time manipulating subroutines.
  1556. X * The following library routines use it:
  1557. X *    libc: ctime, localtime, gmtime, asctime
  1558. X *    libcx: partime, maketime (may not be installed yet)
  1559. X */
  1560. X
  1561. Xstruct tm {     /* See defines below for allowable ranges */
  1562. X    int tm_sec;
  1563. X    int tm_min;
  1564. X    int tm_hour;
  1565. X    int tm_mday;
  1566. X    int tm_mon;
  1567. X    int tm_year;
  1568. X    int tm_wday;
  1569. X    int tm_yday;
  1570. X    int tm_isdst;
  1571. X    int tm_zon;    /* NEW: mins westward of Greenwich */
  1572. X    int tm_ampm;    /* NEW: 1 if AM, 2 if PM */
  1573. X};
  1574. X
  1575. X#define LCLZONE (5*60)    /* Until V7 ftime(2) works, this defines local zone*/
  1576. X#define TMNULL (-1)    /* Items not specified are given this value
  1577. X             * in order to distinguish null specs from zero
  1578. X             * specs.  This is only used by partime and
  1579. X             * maketime. */
  1580. X
  1581. X    /* Indices into TM structure */
  1582. X#define TM_SEC 0    /* 0-59            */
  1583. X#define TM_MIN 1    /* 0-59            */
  1584. X#define TM_HOUR 2    /* 0-23            */
  1585. X#define TM_MDAY 3    /* 1-31            day of month */
  1586. X#define TM_DAY TM_MDAY    /*  "            synonym      */
  1587. X#define TM_MON 4    /* 0-11            */
  1588. X#define TM_YEAR 5    /* (year-1900) (year)    */
  1589. X#define TM_WDAY 6    /* 0-6            day of week (0 = Sunday) */
  1590. X#define TM_YDAY 7    /* 0-365        day of year */
  1591. X#define TM_ISDST 8    /* 0 Std, 1 DST        */
  1592. X    /* New stuff */
  1593. X#define TM_ZON 9    /* 0-(24*60) minutes west of Greenwich */
  1594. X#define TM_AMPM 10    /* 1 AM, 2 PM        */
  1595. END_OF_FILE
  1596. if test 1351 -ne `wc -c <'src/rcstime.h'`; then
  1597.     echo shar: \"'src/rcstime.h'\" unpacked with wrong size!
  1598. fi
  1599. # end of 'src/rcstime.h'
  1600. fi
  1601. if test -f 'src/register.c' -a "${1}" != "-c" ; then 
  1602.   echo shar: Will not clobber existing file \"'src/register.c'\"
  1603. else
  1604. echo shar: Extracting \"'src/register.c'\" \(737 characters\)
  1605. sed "s/^X//" >'src/register.c' <<'END_OF_FILE'
  1606. X#ifndef lint
  1607. Xstatic char rcsid[] = "$Id: register.c,v 1.5 89/11/19 23:20:21 berliner Exp $";
  1608. X#endif !lint
  1609. X
  1610. X/*
  1611. X *    Copyright (c) 1989, Brian Berliner
  1612. X *
  1613. X *    You may distribute under the terms of the GNU General Public License
  1614. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1615. X *
  1616. X * Register
  1617. X *
  1618. X *    Enters the given file name/version/time-stamp into the administration,
  1619. X *    removing the old entry first, if necessary.
  1620. X */
  1621. X
  1622. X#include "cvs.h"
  1623. X
  1624. XRegister(fname, vn, ts)
  1625. X    char *fname;
  1626. X    char *vn;
  1627. X    char *ts;
  1628. X{
  1629. X    FILE *fpin;
  1630. X
  1631. X    Scratch_Entry(fname);
  1632. X    fpin = open_file(CVSADM_ENT, "a");
  1633. X    if (fprintf(fpin, "%s|%s|\n", vn, ts) == EOF)
  1634. X    error(1, "cannot write to file %s", fname);
  1635. X    (void) fclose(fpin);
  1636. X}
  1637. END_OF_FILE
  1638. if test 737 -ne `wc -c <'src/register.c'`; then
  1639.     echo shar: \"'src/register.c'\" unpacked with wrong size!
  1640. fi
  1641. # end of 'src/register.c'
  1642. fi
  1643. if test -f 'src/remove.c' -a "${1}" != "-c" ; then 
  1644.   echo shar: Will not clobber existing file \"'src/remove.c'\"
  1645. else
  1646. echo shar: Extracting \"'src/remove.c'\" \(2134 characters\)
  1647. sed "s/^X//" >'src/remove.c' <<'END_OF_FILE'
  1648. X#ifndef lint
  1649. Xstatic char rcsid[] = "$Id: remove.c,v 1.9 89/11/19 23:40:43 berliner Exp $";
  1650. X#endif !lint
  1651. X
  1652. X/*
  1653. X *    Copyright (c) 1989, Brian Berliner
  1654. X *
  1655. X *    You may distribute under the terms of the GNU General Public License
  1656. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1657. X *
  1658. X * Remove a File
  1659. X *
  1660. X *    Removes entries from the present version.
  1661. X *    The entries will be removed from the RCS repository upon the
  1662. X *    next "commit".
  1663. X *
  1664. X *    "remove" accepts no options, only file names that are to be
  1665. X *    removed.  The file must not exist in the current directory
  1666. X *    for "remove" to work correctly.
  1667. X */
  1668. X
  1669. X#include <sys/param.h>
  1670. X#include "cvs.h"
  1671. X
  1672. Xremove(argc, argv)
  1673. X    int argc;
  1674. X    char *argv[];
  1675. X{
  1676. X    register int i;
  1677. X    char fname[MAXPATHLEN];
  1678. X    int err = 0;
  1679. X
  1680. X    if (argc == 1 || argc == -1)
  1681. X    remove_usage();
  1682. X    argc--;
  1683. X    argv++;
  1684. X    Name_Repository();
  1685. X    for (i = 0; i < argc; i++) {
  1686. X    (void) strcpy(User, argv[i]);
  1687. X    Version_TS(Rcs, Tag, User);
  1688. X    if (TS_User[0] != '\0') {
  1689. X        warn(0, "%s still exists", User);
  1690. X        err++;
  1691. X        continue;
  1692. X    }
  1693. X    if (VN_User[0] == '\0') {
  1694. X        warn(0, "there is no entry for %s", User);
  1695. X        err++;
  1696. X    } else if (VN_User[0] == '0' && VN_User[1] == '\0') {
  1697. X        /*
  1698. X         * It's a file that has been added, but not commited yet.
  1699. X         * So, remove the ,p and ,t file for it and scratch it from
  1700. X         * the entries file.
  1701. X         */
  1702. X        Scratch_Entry(User);
  1703. X        (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  1704. X        (void) unlink(fname);
  1705. X        (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_LOG);
  1706. X        (void) unlink(fname);
  1707. X    } else if (VN_User[0] == '-') {
  1708. X        /*
  1709. X         * It's already been flagged for removal, nothing more to do.
  1710. X         */
  1711. X        warn(0, "%s was already removed", User);
  1712. X        err++;
  1713. X    } else {
  1714. X        /*
  1715. X         * Re-register it with a negative version number.
  1716. X         */
  1717. X        (void) strcpy(fname, "-");
  1718. X        (void) strcat(fname, VN_User);
  1719. X        Register(User, fname, TS_Rcs);
  1720. X    }
  1721. X    }
  1722. X    Entries2Files();            /* and update the Files file */
  1723. X    exit(err);
  1724. X}
  1725. X
  1726. Xstatic
  1727. Xremove_usage()
  1728. X{
  1729. X    (void) fprintf(stderr, "%s %s files...\n", progname, command);
  1730. X    exit(1);
  1731. X}
  1732. END_OF_FILE
  1733. if test 2134 -ne `wc -c <'src/remove.c'`; then
  1734.     echo shar: \"'src/remove.c'\" unpacked with wrong size!
  1735. fi
  1736. # end of 'src/remove.c'
  1737. fi
  1738. if test -f 'src/scratch_entry.c' -a "${1}" != "-c" ; then 
  1739.   echo shar: Will not clobber existing file \"'src/scratch_entry.c'\"
  1740. else
  1741. echo shar: Extracting \"'src/scratch_entry.c'\" \(1085 characters\)
  1742. sed "s/^X//" >'src/scratch_entry.c' <<'END_OF_FILE'
  1743. X#ifndef lint
  1744. Xstatic char rcsid[] = "$Id: scratch_entry.c,v 1.5 89/11/19 23:20:24 berliner Exp $";
  1745. X#endif !lint
  1746. X
  1747. X/*
  1748. X *    Copyright (c) 1989, Brian Berliner
  1749. X *
  1750. X *    You may distribute under the terms of the GNU General Public License
  1751. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1752. X *
  1753. X * Scratch Entry
  1754. X *
  1755. X * Removes the argument file from the Entries file.  A backup of the previous
  1756. X * Entries file is placed in Entries.backup.
  1757. X */
  1758. X
  1759. X#include <sys/param.h>
  1760. X#include "cvs.h"
  1761. X
  1762. XScratch_Entry(fname)
  1763. X    char *fname;
  1764. X{
  1765. X    FILE *fpin, *fpout;
  1766. X    char line[MAXLINELEN];
  1767. X    char *cp, *cpend;
  1768. X
  1769. X    rename_file(CVSADM_ENT, CVSADM_ENTBAK);
  1770. X    fpin = open_file(CVSADM_ENTBAK, "r");
  1771. X    fpout = open_file(CVSADM_ENT, "w+");
  1772. X    while (fgets(line, sizeof(line), fpin) != NULL) {
  1773. X    if ((cpend = rindex(line, '|')) && (cp = rindex(line, ' ')) &&
  1774. X        (cp++) && strncmp(fname, cp, MAX((cpend-cp), strlen(fname))) == 0)
  1775. X        continue;
  1776. X    if (fputs(line, fpout) == EOF)
  1777. X        error(1, "cannot write file %s", CVSADM_ENT);
  1778. X    }
  1779. X    (void) fclose(fpin);
  1780. X    (void) fclose(fpout);
  1781. X}
  1782. END_OF_FILE
  1783. if test 1085 -ne `wc -c <'src/scratch_entry.c'`; then
  1784.     echo shar: \"'src/scratch_entry.c'\" unpacked with wrong size!
  1785. fi
  1786. # end of 'src/scratch_entry.c'
  1787. fi
  1788. if test -f 'src/status.c' -a "${1}" != "-c" ; then 
  1789.   echo shar: Will not clobber existing file \"'src/status.c'\"
  1790. else
  1791. echo shar: Extracting \"'src/status.c'\" \(2073 characters\)
  1792. sed "s/^X//" >'src/status.c' <<'END_OF_FILE'
  1793. X#ifndef lint
  1794. Xstatic char rcsid[] = "$Id: status.c,v 1.13 89/11/19 23:40:44 berliner Exp $";
  1795. X#endif !lint
  1796. X
  1797. X/*
  1798. X *    Copyright (c) 1989, Brian Berliner
  1799. X *
  1800. X *    You may distribute under the terms of the GNU General Public License
  1801. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1802. X *
  1803. X * Status Information
  1804. X *
  1805. X *    Prints three lines of information for each of its arguments,
  1806. X *    one for the user file (line 1), one for the newest RCS file
  1807. X *    (line 3) and one for the RCS file both derive from (line 2).
  1808. X */
  1809. X
  1810. X#include "cvs.h"
  1811. X
  1812. Xstatus(argc, argv)
  1813. X    int argc;
  1814. X    char *argv[];
  1815. X{
  1816. X    register int i;
  1817. X    int c;
  1818. X    int long_format = 0;
  1819. X
  1820. X    if (argc == -1)
  1821. X    status_usage();
  1822. X    optind = 1;
  1823. X    while ((c = getopt(argc, argv, "l")) != -1) {
  1824. X    switch (c) {
  1825. X    case 'l':
  1826. X        /*
  1827. X         * XXX - long format not done yet; should probably display
  1828. X         * other people that have checked out the current repository,
  1829. X         * or pieces thereof.
  1830. X         */
  1831. X        long_format = 1;
  1832. X        break;
  1833. X    case '?':
  1834. X    default:
  1835. X        status_usage();
  1836. X        break;
  1837. X    }
  1838. X    }
  1839. X    argc -= optind;
  1840. X    argv += optind;
  1841. X    Name_Repository();
  1842. X    if (long_format)
  1843. X    error(0, "long format status output not done yet");
  1844. X    if (argc == 0) {
  1845. X    Find_Names(&fileargc, fileargv, ALL);
  1846. X    argc = fileargc;
  1847. X    argv = fileargv;
  1848. X    }
  1849. X    for (i = 0; i < argc; i++) {
  1850. X    (void) strcpy(User, argv[i]);
  1851. X    Locate_RCS();
  1852. X    Version_TS(Rcs, Tag, User);
  1853. X    if (TS_User[0] == '\0') {
  1854. X        printf("File:\tno file %s\n", User);
  1855. X    } else {
  1856. X        printf("File:\t%s\n", User);
  1857. X    }
  1858. X    if (VN_User[0] == '\0') {
  1859. X        printf("From:\tno entry for %s\n", User);
  1860. X    } else if (VN_User[0] == '0' && VN_User[1] == '\0') {
  1861. X        printf("From:\tNew file!\n");
  1862. X    } else {
  1863. X        /*
  1864. X         * Only print the modification time
  1865. X         */
  1866. X        printf("From:\t%s\t%s\n", VN_User, &TS_Rcs[25]);
  1867. X    }
  1868. X    if (VN_Rcs[0] == '\0') {
  1869. X        printf("RCS:\tno %s\n", Rcs);
  1870. X    } else {
  1871. X        printf("RCS:\t%s\t%s\n", VN_Rcs, Rcs);
  1872. X    }
  1873. X    printf("\n");
  1874. X    }
  1875. X    exit(0);
  1876. X}
  1877. X
  1878. Xstatic
  1879. Xstatus_usage()
  1880. X{
  1881. X    (void) fprintf(stderr, "Usage: %s %s [files...]\n", progname, command);
  1882. X    exit(1);
  1883. X}
  1884. END_OF_FILE
  1885. if test 2073 -ne `wc -c <'src/status.c'`; then
  1886.     echo shar: \"'src/status.c'\" unpacked with wrong size!
  1887. fi
  1888. # end of 'src/status.c'
  1889. fi
  1890. if test -f 'src/version_ts.c' -a "${1}" != "-c" ; then 
  1891.   echo shar: Will not clobber existing file \"'src/version_ts.c'\"
  1892. else
  1893. echo shar: Extracting \"'src/version_ts.c'\" \(3315 characters\)
  1894. sed "s/^X//" >'src/version_ts.c' <<'END_OF_FILE'
  1895. X#ifndef lint
  1896. Xstatic char rcsid[] = "$Id: version_ts.c,v 1.8 89/11/20 09:51:12 berliner Exp $";
  1897. X#endif !lint
  1898. X
  1899. X/*
  1900. X *    Copyright (c) 1989, Brian Berliner
  1901. X *
  1902. X *    You may distribute under the terms of the GNU General Public License
  1903. X *    as specified in the README file that comes with the CVS 1.0 kit.
  1904. X *
  1905. X * Version and Time Stamp
  1906. X *
  1907. X *    Sets the following global variables:
  1908. X *    VN_User        version # of the RCS file the user file derives from;
  1909. X *            may also be:
  1910. X *                empty:        no entry for user file
  1911. X *                0:        user file is new
  1912. X *                -$VN_User:    user file is to be removed
  1913. X *    VN_Rcs        version # of active RCS file
  1914. X *                is empty for absent RCS file
  1915. X *    TS_User        present time stamp of the user file
  1916. X *                is empty for absent user file
  1917. X *    TS_Rcs        time stamp of the lastest check-out of the RCS file.
  1918. X *
  1919. X *    The syntax of an entry is
  1920. X *        <version-number>|<time-stamp>|
  1921. X *    and the time-stamp currently includes the file change and modify 
  1922. X *    times as well as the User file name.
  1923. X */
  1924. X
  1925. X#include <sys/types.h>
  1926. X#include <sys/timeb.h>
  1927. X#include <sys/stat.h>
  1928. X#include <ctype.h>
  1929. X#include <grp.h>
  1930. X#include <pwd.h>
  1931. X#include <utmp.h>
  1932. X#include "cvs.h"
  1933. X
  1934. X/*
  1935. X * "rcs" is the full pathname to the ,v file; "user" is the name of
  1936. X * the local file.
  1937. X */
  1938. XVersion_TS(rcs, tag, user)
  1939. X    char *rcs;
  1940. X    char *tag;
  1941. X    char *user;
  1942. X{
  1943. X    FILE *fpin;
  1944. X    char line[MAXLINELEN];
  1945. X    char *cp;
  1946. X    int found = 0;
  1947. X
  1948. X    /*
  1949. X     * Get RCS version number in VN_Rcs
  1950. X     */
  1951. X    Version_Number(rcs, tag, Date, VN_Rcs);
  1952. X    time_stamp(user, TS_User);        /* get time-stamp in TS_User */
  1953. X    /*
  1954. X     * Now read through the "Entries" file to find the
  1955. X     * version number of the user file, and the time-stamp
  1956. X     * of the RCS file
  1957. X     */
  1958. X    fpin = open_file(CVSADM_ENT, "r");
  1959. X    while (fgets(line, sizeof(line), fpin) != NULL) {
  1960. X    if ((cp = rindex(line, '|')) == NULL)
  1961. X        continue;
  1962. X    *cp = '\0';
  1963. X    if ((cp = rindex(line, ' ')) == NULL)
  1964. X        continue;
  1965. X    cp++;
  1966. X    if (strcmp(user, cp) == 0) {
  1967. X        found = 1;
  1968. X        break;
  1969. X    }
  1970. X    }
  1971. X    if (found) {
  1972. X    if ((cp = index(line, '|')) != NULL) {
  1973. X        *cp++ = '\0';
  1974. X        (void) strcpy(VN_User, line);
  1975. X        (void) strcpy(TS_Rcs, cp);
  1976. X    } else {
  1977. X        VN_User[0] = '\0';
  1978. X        TS_Rcs[0] = '\0';
  1979. X    }
  1980. X    } else {
  1981. X    VN_User[0] = '\0';
  1982. X    TS_Rcs[0] = '\0';
  1983. X    }
  1984. X    (void) fclose(fpin);
  1985. X}
  1986. X
  1987. X/* Some UNIX distributions don't include these in their stat.h */
  1988. X#ifndef S_IWRITE
  1989. X#define    S_IWRITE    0000200        /* write permission, owner */
  1990. X#endif !S_IWRITE
  1991. X#ifndef S_IWGRP
  1992. X#define    S_IWGRP        0000020        /* write permission, grougroup */
  1993. X#endif !S_IWGRP
  1994. X#ifndef S_IWOTH
  1995. X#define    S_IWOTH        0000002        /* write permission, other */
  1996. X#endif !S_IWOTH
  1997. X
  1998. X/*
  1999. X * Gets the time-stamp for the file "file" and puts it in the already
  2000. X * allocated string "ts".
  2001. X *
  2002. X * As a side effect, if the user wants writable files and the file
  2003. X * currently has no write bits on, the file is made writable now.
  2004. X */
  2005. Xstatic
  2006. Xtime_stamp(file, ts)
  2007. X    char *file;
  2008. X    char *ts;
  2009. X{
  2010. X    struct stat sb;
  2011. X    char *ctime();
  2012. X    char *cp;
  2013. X
  2014. X    if (stat(file, &sb) < 0) {
  2015. X        ts[0] = '\0';
  2016. X    } else {
  2017. X    if (cvswrite == TRUE &&
  2018. X        (sb.st_mode & (S_IWRITE|S_IWGRP|S_IWOTH)) == 0) {
  2019. X        xchmod(file, 1);
  2020. X        (void) stat(file, &sb);
  2021. X    }
  2022. X    cp = ctime(&sb.st_ctime);
  2023. X    cp[24] = ' ';
  2024. X    (void) strcpy(ts, cp);
  2025. X    cp = ctime(&sb.st_mtime);
  2026. X    cp[24] = ' ';
  2027. X    (void) strcat(ts, cp);
  2028. X    (void) strcat(ts, file);
  2029. X    }
  2030. X}
  2031. END_OF_FILE
  2032. if test 3315 -ne `wc -c <'src/version_ts.c'`; then
  2033.     echo shar: \"'src/version_ts.c'\" unpacked with wrong size!
  2034. fi
  2035. # end of 'src/version_ts.c'
  2036. fi
  2037. echo shar: End of archive 1 \(of 7\).
  2038. cp /dev/null ark1isdone
  2039. MISSING=""
  2040. for I in 1 2 3 4 5 6 7 ; do
  2041.     if test ! -f ark${I}isdone ; then
  2042.     MISSING="${MISSING} ${I}"
  2043.     fi
  2044. done
  2045. if test "${MISSING}" = "" ; then
  2046.     echo You have unpacked all 7 archives.
  2047.     rm -f ark[1-9]isdone
  2048. else
  2049.     echo You still need to unpack the following archives:
  2050.     echo "        " ${MISSING}
  2051. fi
  2052. ##  End of shell archive.
  2053. exit 0
  2054. exit 0 # Just in case...
  2055.